function DOMAware() {
    var _dom;
    var _onload;
    var _connectionDown=false;
    this.getDOM = function(onload) {
        debugger;
        if (_dom == null && !_connectionDown) {
            _onload=onload;
            this._initDOM();
        }
        return _dom;
    };
    this._initDOM = function() {
        var address = this.getAddress();
        //debugger;
        var request = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
                .createInstance(Components.interfaces.nsIXMLHttpRequest);
        //TODO: errore di design: la richiesta dovrebbe essere asincrona. Implementare observe

        request.open('GET', address, true);
        request.onload = function() {
            //il wrapper serve per consentire a jquery l'inizializzazione del DOM
            var wrapper=document.getElementById("ssriwatcher-wrapper");
            _dom = SSRIQuery("<div>" + request.responseText + "<div>",wrapper.contentDocument);
            if(_onload!=null)
                _onload.notify();
        };
        request.onerror = function(e) {
            Logger.error("Error " + e.target.status + " occurred while receiving the document.");
        };
        try{
            request.send(null);
        }catch(err){
            // connessione down
            _connectionDown=true;
        }
    };
}
DOMAware.prototype.getAddress = function() {
    return null;
};

